package com.hudson.plugin.server.hibernateDB.domain.dao;

import com.hudson.plugin.server.hibernateDB.internal.domain.entity.PromotionBuildsEntity;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 5/29/11
 * Time: 10:42 PM
 * To change this template use File | Settings | File Templates.
 */
public interface PromotionBuildsDAOInterface {
    // property constants
    String PROMOTION_NUM = "promotionNum";
    String AUTHOR = "author";
    String RESULT = "result";
    String DURATION = "duration";
    String BUILD_ON = "buildOn";

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void save(PromotionBuildsEntity transientInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void delete(PromotionBuildsEntity persistentInstance);

    List findByProperty(String propertyName, Object value);

    PromotionBuildsEntity findById(Integer id);

    List findByPromotionNum(Object promotionNum);

    List findByAuthor(Object author);

    List findByResult(Object result);

    List findByDuration(Object duration);

    List findByBuildOn(Object buildOn);

    List findAll();

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    PromotionBuildsEntity merge(PromotionBuildsEntity detachedInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachDirty(PromotionBuildsEntity instance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachClean(PromotionBuildsEntity instance);
}
